package com.cn.lp.openapi.reflect;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class GSsistAide {

	private final static ConcurrentMap<Class<?>, GClass> classMap = new ConcurrentHashMap<Class<?>, GClass>();

	/**
	 * 获取CGLib字节码
	 * @param clazz
	 * @return
	 */
	public static GClass getGClass(Class<?> clazz) {
		GClass gClass = classMap.get(clazz);
		if (gClass != null)
			return gClass;
		synchronized (clazz) {
			gClass = classMap.get(clazz);
			if (gClass != null)
				return gClass;
			gClass = new GSsistClass(clazz);
			GClass oldClass = classMap.putIfAbsent(clazz, gClass);
			return oldClass == null ? gClass : oldClass;
		}
	}

}
